package com.tang.service.engine.impl;

import com.tang.entity.CarInfo;
import com.tang.model.aggregates.TreeRich;
import com.tang.model.vo.EngineResult;
import com.tang.model.vo.TreeNode;
import com.tang.service.engine.EngineBase;

/**
 * 规则引擎执行类
 *
 * @author Tang
 */
public class TreeEngineHandle extends EngineBase {

    @Override
    public EngineResult process(Long treeId, String userId, TreeRich treeRich, CarInfo carInfo) {
        // 决策流程
        TreeNode treeNode = engineDecisionMaker(treeRich, treeId, userId, carInfo);
        // 通过teeNode信息再通过反射调用对应的Service

        // 决策结果
        return new EngineResult(userId, treeId, treeNode.getTreeNodeId(), treeNode.getNodeValue());
    }

}
